<?php

namespace App\Http\Validator;

use \Prettus\Validator\Contracts\ValidatorInterface;

class UserValidator extends BaseValidator {

    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'mobile' => 'bail|required|unique:users|regex:/' . self::MOBILE_REGULAR . '/',
        ],
        ValidatorInterface::RULE_UPDATE => [
            'mobile' => 'required|regex:' . self::MOBILE_REGULAR,
        ]
    ];

    protected $messages = [
        'mobile.required' => ':attribute不能为空',
        'mobile.unique' => '该:attribute已注册',
        'mobile.regex' => ':attribute格式不正确',
    ];

    protected $attributes = [
        "mobile" => '手机号码',
    ];
}
